import Vue from 'vue'
import Router from 'vue-router'

const qstrategy = resolve => require(['@/page/home/strategy'],resolve)
const qstrategybyall = resolve => require(['@/page/strategy/all.vue'],resolve)

const subscribe = resolve => require(['@/page/subscribe.vue'],resolve)
const my = resolve => require(['@/page/home/my'],resolve)
const open1 = resolve => require(['@/page/open1.vue'],resolve)
const open2 = resolve => require(['@/page/open2.vue'],resolve)
const open3 = resolve => require(['@/page/open3.vue'],resolve)
const open4 = resolve => require(['@/page/open4.vue'],resolve)
const open5 = resolve => require(['@/page/open5.vue'],resolve)
const agreement = resolve => require(['@/page/agreement.vue'],resolve)
const pdf = resolve => require(['@/page/pdf.vue'],resolve)
const sign = resolve => require(['@/page/sign.vue'],resolve)
const test = resolve => require(['@/page/test.vue'],resolve)

const index = resolve => require(['@/page/home/index'],resolve)
const video = resolve => require(['@/page/video.vue'],resolve)
const videoSuccess = resolve => require(['@/page/videoSuccess.vue'],resolve)
const newper = resolve => require(['@/page/newper.vue'],resolve)
const signal = resolve => require(['@/page/signal.vue'],resolve)
const signalSuccess = resolve => require(['@/page/signalSuccess.vue'],resolve)
const login = resolve => require(['@/page/login.vue'],resolve)
const register = resolve => require(['@/page/register.vue'],resolve)
const confirm = resolve => require(['@/page/confirm.vue'],resolve)
const country = resolve => require(['@/page/country.vue'],resolve)
const buySuccess = resolve => require(['@/page/buySuccess.vue'],resolve)
const followSuccess = resolve => require(['@/page/followSuccess.vue'],resolve)
const strategy = resolve => require(['@/page/strategy.vue'],resolve)
const laboratory = resolve => require(['@/page/home/laboratory.vue'],resolve)
const laboratoryDetail = resolve => require(['@/page/laboratoryDetail.vue'],resolve)
const reset = resolve => require(['@/page/reset.vue'],resolve)
const newpwd = resolve => require(['@/page/newpwd.vue'],resolve)
const confirmChange = resolve => require(['@/page/confirmChange.vue'],resolve)
const safe = resolve => require(['@/page/safe.vue'],resolve)
const name = resolve => require(['@/page/name.vue'],resolve)
const email = resolve => require(['@/page/email.vue'],resolve)
const modifyPwd = resolve => require(['@/page/modifyPwd.vue'],resolve)
const suggestion = resolve => require(['@/page/suggestion.vue'],resolve)
const searchCom = resolve => require(['@/page/searchCom.vue'],resolve)
const messageCenter = resolve => require(['@/page/messageCenter.vue'],resolve)
const accountSuccess = resolve => require(['@/page/accountSuccess.vue'],resolve)
const help = resolve => require(['@/page/help/help'], resolve)

const qstrategybycountry = resolve => require(['@/page/strategy/strategybycountry.vue'], resolve)
const riskratings = resolve => require(['@/page/riskratings.vue'], resolve)
const riskLevelquestion = resolve => require(['@/page/riskLevelquestion.vue'], resolve)
const risk = resolve => require(['@/page/risk.vue'], resolve)
const home = resolve => require(['@/page/home/home.vue'], resolve)
const income = resolve => require(['@/page/income/income.vue'], resolve)
const newlaboratory = resolve => require(['@/page/laboratory/new.vue'], resolve)
const analysis = resolve => require(['@/page/income/analysis.vue'],resolve)
const monitor = resolve => require(['@/page/income/monitor.vue'],resolve)
const account = resolve => require(['@/page/income/account.vue'],resolve)
const videoSearch = resolve => require(['@/page/videoSearch.vue'],resolve)
const iwantstrategy = resolve => require(['@/page/strategy/iwant.vue'], resolve)
const arithmeticstrategy = resolve => require(['@/page/strategy/arithmetic.vue'], resolve)
const breakeven = resolve => require(['@/page/strategy/breakeven.vue'], resolve)
const bankOpen = resolve => require(['@/page/bank/bankOpen.vue'], resolve)
const bankSuccess = resolve => require(['@/page/bank/bankSuccess.vue'], resolve)
const bankAgreement = resolve => require(['@/page/bank/bankAgreement.vue'], resolve)
const bankAuthorization = resolve => require(['@/page/bank/bankAuthorization.vue'], resolve)
const fixIncome = resolve => require(['@/page/bank/fixIncome.vue'],resolve)


Vue.use(Router)

Router.prototype.go = () => {
  window.isBack = true
  window.history.go(-1)
}

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/index',
      component: home,
      meta: {
        keepAlive: true
      },
      children: [
        {
          path: '/index',
          component: index,
          meta: {
            background: '#7288F8',
            keepAlive: true
            // cache周期 12hours activated不获取数据
          }
        },
        {
          path: '/qstrategy',
          component: qstrategy,
          meta: {
            keepAlive: true,
            // cache周期 15min activated 获取数据
            scroll: 0,
            currentIdx: '/all'
          },
          children: [
            {
              path: '/qstrategy/signal',
              component: signal,
              meta: {
                keepAlive: true
              }
            },
            {
              path: '/qstrategy/fixIncome',
              component: fixIncome,
              meta: {
                keepAlive: true
              }
            },
            {
              path: '/qstrategy/breakeven',
              component: breakeven,
              meta: {
                keepAlive: true
              }
            },
            {
              path: '/qstrategy/all',
              component: qstrategybyall,
              meta: {
                scroll: 0,
                keepAlive: true
              }
            },
            {
              path: '/qstrategy/:id',
              component: qstrategybycountry,
              meta: {
                keepAlive: true
              }
            }
          ]
        },
        {
          path: '/my',
          component: my,
          meta: {
            background: 'linear-gradient(to right, #6379F8 0%,#91A5F8 100%)',
            keepAlive: true
          }
        },
        {
          path: '/laboratory',
          component: laboratory,
          meta: {
            keepAlive: true
          }
        },
        {
          path: '/income',
          component: income,
          children: [
            {
              path: '/income/analysis',
              component: analysis,
              meta: {
                keepAlive: true,
                title: '我的收益'
              }
            },
            {
              path: '/income/monitor',
              component: monitor,
              meta: {
                keepAlive: true,
                title: '我的收益'
              }
            },
            {
              path: '/income/account',
              component: account,
              meta: {
                keepAlive: true,
                title: '我的收益'
              }
            }
          ],
          meta: {
            keepAlive: true
          }
        },
        {
          path: '/strategy',
          component: strategy
        }
      ]
    },
    {
      path: '/iwantstrategy',
      component: iwantstrategy
    },
    {
      path: '/arithmeticstrategy',
      component: arithmeticstrategy,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/help',
      component: help,
      meta: {
        keepAlive: true,
        title: '帮助中心'
      }
    },
    {
      path: '/laboratory/new',
      component: newlaboratory,
      meta: {
        keepAlive: true,
        title: '创建新实验',
        transfer: true
      }
    },
    {
     path: '/risklevelquestion',
     component: riskLevelquestion,
     meta: {
       keepAlive: true
     }
    },
    {
      path: '/risk',
      component: risk,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/riskratings',
      component: riskratings,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/subscribe',
      component:  subscribe,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/buySuccess',
        component: buySuccess
    },
    {
      path: '/followSuccess',
      component: followSuccess
    },
    {
      path: '/open1',
      component: open1
    },
    {
      path: '/open2',
      component: open2,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/open3',
      component: open3,
      //meta: {
      //  keepAlive: true
      //}
    },
    {
      path: '/open4',
      component: open4,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/open5',
      component: open5,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/agreement',
      component: agreement
    },
    {
      path: '/pdf',
      component: pdf
    },
    {
      path: '/sign',
      component: sign
      //meta: {
      //  keepAlive: true
      //}
    },
    {
      path: '/signalSuccess',
      component: signalSuccess
    },
    {
      path: '/test',
        component: test
    },
    {
      path: '/index',
        component: index
    },
    {
      path: '/video',
      component: video,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/videoSearch',
      component: videoSearch,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/videoSuccess',
      component: videoSuccess
    },
    {
      path: '/newper',
      component: newper,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/login',
        component: login
    },
    {
      path: '/register',
        component: register
    },
    {
      path: '/confirm',
        component: confirm
    },
    {
      path: '/country',
        component: country
    },
    //{
    //  path: '/income',
    //    component: income
    //},
    {
      path: '/laboratoryDetail',
      component: laboratoryDetail,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/reset',
        component: reset
    },
    {
      path: '/newpwd',
        component: newpwd
    },
    {
      path: '/confirmChange',
        component: confirmChange
    },
    {
      path: '/safe',
      component: safe,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/name',
      component: name
    },
    {
      path: '/email',
      component: email
    },
    {
      path: '/modifyPwd',
      component: modifyPwd
    },
    {
      path: '/suggestion',
      component: suggestion
    },
    {
      path: '/searchCom',
      component: searchCom
    },
    {
      path: '/messageCenter',
      component: messageCenter,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/accountSuccess',
      component: accountSuccess
    },
    {
      path: '/bankOpen',
      component: bankOpen
    },
    {
      path: '/bankSuccess',
      component: bankSuccess
    },
    {
      path: '/bankAgreement',
      component: bankAgreement
    },
    {
      path: '/bankAuthorization',
      component: bankAuthorization
    }
  ]
})
